Expand references of DocuemntStore schemas #93
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fix for #92.
Calls
expand_references!
on loaded schemas before adding them to theDocumentStore
. This is intended to fix a bug where complex schemasthat include more than one level of cross-file use of
$ref
s are notbeing validated correctly.
This commit includes new test cases that reproduce this issue and show
the effectiveness of the proposed fix.
The inspiration for this fix comes from a command included in the
json_schema
gem. In that gem, the stand-alone validator commandexpands references within schemas before adding them to the store.
It seems reasonable to do the same here.
See https://github.com/brandur/json_schema/blob/20ccb82d7e18140d88ded508edd6c003865c98a0/lib/commands/validate_schema.rb#L92.